package cn.dengta.webapp.live.model;

import javax.annotation.Nullable;

import cn.dengta.common.model.ValueProxy;
import cn.dengta.context.model.LabelI18nProxy;
import lombok.Getter;

/**
 * 直播状态枚举
 */
@Getter
public enum LiveStatus implements LabelI18nProxy<LiveStatus, Integer> {
	/** 待审核 */
	WAIT_VERIFY(0, "待审核"),
	/** 启用 */
	VALID(1, "启用"),
	//
	;

	public final Integer value;
	public final ValueProxy<LiveStatus, Integer> proxy;

	LiveStatus(Integer value, String label) {
		this.value = value;
		this.proxy = new ValueProxy<>(this, value, label);
	}

	public static boolean canLive(@Nullable Integer status) {
		return status != null && status > LiveStatus.WAIT_VERIFY.value;
	}

	public static LiveStatus[] getValues() {
		return ValueProxy.getCachedArray(LiveStatus.class, LiveStatus::values);
	}

	public static LiveStatus of(Integer value) {
		return WAIT_VERIFY.getValueOf(value);
	}

}
